#ifndef PLAYLISTVIEW_H
#define PLAYLISTVIEW_H

#include<QHBoxLayout>
#include<QMenu>
#include<QPointer>
#include<QPushButton>
#include<QToolButton>
#include<QVBoxLayout>
#include<QWidget>

class ListWidget;
class Playlist;
class QListWidgetItem;
class Song;
class SongItem;

#include"Player.h"

class PlaylistView: public QWidget{
Q_OBJECT
public:
	PlaylistView(QWidget *parent = 0);
	~PlaylistView();
	
	//setPlayList really doesn't belong here anymore :/
	void setPlaylist(Playlist *playlist);
	void addPlayAction(QAction *playPauseAction);
	void addStopAction(QAction *stopAction);
	void addMedia(const QStringList &media);
// 	Playlist *playlist()const{ return m_playlist; }
signals:
	void play();
	void stop();
	void changePlaylistType(QString newType);
	void addSongToPlaylist(QPointer<Song> song, short int index = -1);
	void requestedEditMetadata(QList<QString> songPaths);
	void removeSongs(QList<short int> indices);
public slots:
	void addSong(QPointer<Song> song, short int index = -1);
	void slotAddSongToPlaylist(QPointer<Song> song, short int index = -1);
	void currentChanged(short int index);
	void stopAfterCurrent();
	void slotCleared();
//	void slotPlayerStateChanged(Player::State state);
	void slotSongRemoved(short int index);
private slots:
	void slotButtonClear();
	void slotItemActivated(QListWidgetItem *item);
	void slotPlaylistSequential();
	void slotPlaylistRandom();
	void slotPlaylistNoRepeat();
	void slotPlaylistRepeatAll();
	void slotPlaylistRepeatOne();
	void slotRequestedEditMetadata(QList<QString> songPaths);
	void slotRemoveSongs(QList<short int> indices);
	//Shouldn't be necessary anymore, through the use of QPointers
	void slotSongDeleted();
private:
	Playlist *m_playlist;
	ListWidget *m_listWidget;
	QVBoxLayout *m_layout;
	SongItem *m_current;
	
	QWidget *m_buttonWidget;
	QHBoxLayout *m_buttonLayout;
	QPushButton *m_buttonClear;
	QMenu *m_playlistMenu;
	QToolButton *m_playlistMenuButton;
	QAction *m_actionPlayPause;
};

#endif
